package com.dichain.tos.sendsms;

import javax.xml.rpc.ServiceException;

import com.yuexunit.finance.common.httpclient.HttpClientHelper;
import com.yuexunit.finance.project.action.v1.model.output.ContainerInventoryTrackingDetail;
import com.yuexunit.jsonutil.JSON;

import java.rmi.RemoteException;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by IntelliJ IDEA. User: Administrator Date: 2015-7-11 Time: 9:16:01 To change this template use File | Settings | File Templates.
 */
public final class SmsSendUtil {

	private final static String apichkPwd = "654c0e6cd3399734ed80edf0bcc04bdc";

	public static final String sendSMS(String sendUser, String mobileList, String message) {
		SendSMS soap = new SendSMSLocator();
		try {
			return soap.getsendSMSSoap().sendMessage(sendUser, apichkPwd, mobileList, message);
		} catch (RemoteException e) {
			e.printStackTrace();
		} catch (ServiceException e) {
			e.printStackTrace();
		}
		return "success";
	}

	/**
	 * test
	 * @param args
	 */
	public static void main1(String[] args) {
		String sendUser = "仁建物流";
		String mobileList = "15280091258";// "13026681634";
		String message = "SEND 仁建物流....";
		System.out.println(sendSMS(sendUser, mobileList, message));
	}

	public static void main(String[] args) {
//		 String url = "http://222.79.247.163:8080/StarChainRemote/servlet/getTraceGoodsList";
		String url = "http://api.antong56.com:9090/StarChainRemote/servlet/getTraceGoodsList";
		Map<String, String> params = new HashMap<>();
		params.put("userGUID", "vjAAAAEorW/L++se");
		params.put("userID", "at");
		params.put("boxNO", "ATLU0003d228");
		params.put("billNO", "ATHKTJ15517260");
		String responseText = HttpClientHelper.post(url, params);
		System.out.println(responseText);
		ContainerInventoryTrackingDetail bean = JSON.toBean(responseText, ContainerInventoryTrackingDetail.class);
		
//		String url = "http://192.168.31.124:8080/kft-activiti-demo/workflow/start";
//		Map<String, String> params = new HashMap<>();
//		params.put("processDefinitionKey", "reimprocess");
//		params.put("businessKey", "2");
//		params.put("userId", "1");
//		String responseText = HttpClientHelper.post(url, params);
//		System.out.println(responseText);
//		ContainerInventoryTrackingDetail bean = JSON.toBean(responseText, ContainerInventoryTrackingDetail.class);
//		System.out.println(bean.getResultList().get(0).getTraceTime());
//		System.out.println(bean.getResultList().get(0).getTraceDateTime());

	}
}